package lb.select.controller;


import lb.select.pojo.Student;
import lombok.experimental.var;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.Mapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

@Controller
public class IndexController {

    @GetMapping("/")
    public String index(){
        return "index";
    }

    @PostMapping("getData")
    @ResponseBody
    public List<Student> getData(String q, String page){
        Student student = Student.builder().id(1).userName("张三").sex("男").build();
        Student student2 = Student.builder().id(2).userName("李四").sex("女").build();
        Student student3 = Student.builder().id(3).userName("王五").sex("男").build();
        Student student4 = Student.builder().id(4).userName("赵柳").sex("男").build();

        List<Student> studentList = new ArrayList<Student>();
        studentList.add(student);
        studentList.add(student2);
        studentList.add(student3);
        studentList.add(student4);
        return studentList;
    }
}
